]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
animation: Scale animation actor for HiDPI
authorDaniel García Moreno <dani@danigm.net>
Fri, 17 Jan 2020 09:12:52 +0000 (10:12 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 30 Jan 2020 14:28:45 +0000 (14:28 +0000)
The Animation class inherits from St.Bin and manages the scale factor
in the image loading, but the widget size doesn't change and doesn't
depend on the scale factor so when the scale factor is different
from 1 the widget size doesn't match the image size.

This patch resizes the Animation widget using the scale factor so the
widget will match the animation images sizes.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1746

js/ui/animation.js

index 5cd9f3a20733b418d4ec1eb809af689d394e6abb..2344851adc13bea575af441d6951b382d5f6716f 100644 (file)
@@ -12,14 +12,22 @@ var SPINNER_ANIMATION_DELAY = 1000;
 var Animation = GObject.registerClass(
 class Animation extends St.Bin {
     _init(file, width, height, speed) {
-        super._init({ width, height });
+        const themeContext = St.ThemeContext.get_for_stage(global.stage);
+
+        super._init({
+            width: width * themeContext.scale_factor,
+            height: height * themeContext.scale_factor,
+        });
+
         this.connect('destroy', this._onDestroy.bind(this));
         this.connect('resource-scale-changed',
             this._loadFile.bind(this, file, width, height));
 
-        let themeContext = St.ThemeContext.get_for_stage(global.stage);
         this._scaleChangedId = themeContext.connect('notify::scale-factor',
-            this._loadFile.bind(this, file, width, height));
+            () => {
+                this._loadFile(file, width, height);
+                this.set_size(width * themeContext.scale_factor, height * themeContext.scale_factor);
+            });
 
         this._speed = speed;